<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改账本分类')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-account-edit" th:object="${accountClass}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">分类名称：</label>
                <div class="col-sm-8">
                    <input name="className" th:field="*{className}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">分类图标：</label>
                <div class="col-sm-8">
                    <input name="classIcon"th:field="*{classIcon}" class="form-control" type="text">
                    <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 图标来源：https://fontawesome.p2hp.com/faicons.html </span>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">分类类型：</label>
                <div class="col-sm-8">
                    <select name="classType" class="form-control" th:with="type=${@dict.getType('account_income_pay')}" required>
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{classType}"></option>
                    </select>
                    <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 请在字典管理添加 字典类型：account_income_pay</span>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">收支状态：</label>
                <div class="col-sm-8">
                    <div class="radio-box">
                        <input name="status" title="支出" type="radio" value="1" th:checked="*{status == '1'} ? true : false">
                        <label value="1" th:text="收入"></label>
                    </div>
                    <div class="radio-box">
                        <input name="status" title="收入" type="radio" value="2" th:checked="*{status == '2'} ? true : false">
                        <label value="2" th:text="支出"></label>
                    </div>
                    <div class="radio-box">
                        <input name="status" title="停用" type="radio" value="3" th:checked="*{status == '3'} ? true : false">
                        <label value="3" th:text="不计入"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">分类介绍：</label>
                <div class="col-sm-8">
                    <input name="classIntroduce" th:field="*{classIntroduce}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">显示顺序：</label>
                <div class="col-sm-8">
                    <input name="orderNum" th:field="*{orderNum}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">分类状态：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('sys_normal_disable')}">
                        <input type="radio" th:id="${'classStatus_' + dict.dictCode}" name="classStatus" th:value="${dict.dictValue}" th:field="*{classStatus}">
                        <label th:for="${'classStatus_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "account/classif";
        $("#form-account-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-account-edit').serialize());
            }
        }
    </script>
</body>
</html>
